package com.pand.model.order;

import com.pand.model.BaseObject;

import javax.persistence.*;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 
 * @ClassName: OrderItem
 * @Description: 订单详细表
 *
 */
@Entity
@Table(name = "BIZ_ORDER_ITEM")
@SequenceGenerator(name = "SeqOrderItem", sequenceName = "SEQ_ORDER_ITEM", allocationSize = 1)
public class OrderItem extends BaseObject {

	/**
	 * @Fields serialVersionUID :
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * 主键 
	 */
	private Long id;
	
	/**
	 * 订单号
	 */
	private String orderNo;
	
	/**
	 * 车辆ID
	 */
	private Long vehicleId;
	
	/**
	 * 车牌号
	 */
	private String license;
	
	/**
	 * 预定取车时间
	 */
	private Date getTime; 
	
	/**
	 * 预定还车时间
	 */
	private Date retTime;
	
	/**
	 * 真是取车时间
	 */
	private Date realGetTime; 
	
	/**
	 * 真是还车时间
	 */
	private Date realRetTime;
	
	/**
	 * 取车里程
	 */
	private Double getKm;
	
	/**
	 * 还车里程
	 */
	private Double retKm;
	
	/**
	 * 行驶里程
	 */
	private Double runMiles;
	
	/**
	 * 取车电量
	 */
	private Double getElec;
	
	/**
	 * 还车电量
	 */
	private Double retElec;
	
	/**
	 * 
	 */
	private String getChecker;
	
	/**
	 * 
	 */
	private String retChecker;
	
	/**
	 * 取车备注
	 */
	private String getRemark;
	
	/**
	 * 还车备注
	 */
	private String retRemark;
	
	/**
	 * 取车站点
	 */
	private Long getStationId;
	
	/**
	 * 还车站点
	 */
	private Long retStationId;
	
	/**
	 * 取车操作人ID
	 */
	private Long getOperatorId;
	
	/**
	 * 还车操作人ID
	 */
	private Long retOperatorId;
	
	/**
	 * 创建时间
	 */
	private Date createTime;
	
	/**
	 * 
	 */
	private Date modTime;
	
	/**
	 * 车型ID
	 */
	private Long vehicleTypeId; 
	
	/**
	 * 车型名称
	 */
	private String vehicleTypeName;
	
	/**
	 * 租赁类型
	 */
	private String rentalType; 
	
	/**
	 * 租赁费用
	 */
	private Double rentalFee; 
	
	/**
	 * 订单行总费用，包含租赁费和附加服务费
	 */
	private Double totalAmount;
	
	/**
	 * 服务费
	 */
	private Double attatchServiceFee;
	
	/**
	 *  订单押金
	 */
	private Double deposit;
	
	/**
	 * 计价数量
	 */
	private Integer chargeAmount; 
	
	/**
	 * 还车经度
	 */
	private Double retLongtitude;
	
	/**
	 * 还车纬度
	 */
	private Double retLatitude;
	
	/**
	 * 租赁价格
	 */
	private Double rentalPrice;
	
	/**
	 * 租赁时间
	 */
	private Long rentalTime;
	
	/**
	 * 派车时间
	 */
	private Date allotTime;
	
	/**
	 * 预定取车时间
	 */
	private transient String displayGetTime;
	
	/**
	 * 预定取车时间
	 */
	private transient String displayRetTime;
	
	/**
	 * 订单租赁价格时id
	 */
	private Long priceId;
	
	/**
	 * 订单租赁价格日id
	 */
	private Long cpriceId;
	
	/**
	 * 真实还车网点id
	 */
	private Long realRetStationId; 

	@Id
	@GeneratedValue(generator = "SeqOrderItem")
	@Column(name = "ID")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@Column(name = "ORDER_NO")
	public String getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}

	@Column(name = "VEHICLE_ID")
	public Long getVehicleId() {
		return vehicleId;
	}

	public void setVehicleId(Long vehicleId) {
		this.vehicleId = vehicleId;
	}

	@Column(name = "LICENSE")
	public String getLicense() {
		return license;
	}

	public void setLicense(String license) {
		this.license = license;
	}

	@Column(name = "GET_TIME")
	public Date getGetTime() {
		return getTime;
	}

	public void setGetTime(Date getTime) {
		this.getTime = getTime;
		if(getTime!=null){
			this.displayGetTime = new SimpleDateFormat("yyyy-MM-dd HH:mm")
					.format(getTime);
		}
	}

	@Column(name = "RET_TIME")
	public Date getRetTime() {
		return retTime;
	}

	public void setRetTime(Date retTime) {
		this.retTime = retTime;
		if(retTime!=null){
			this.displayRetTime = new SimpleDateFormat("yyyy-MM-dd HH:mm")
					.format(retTime);
		}
	}

	@Column(name = "REAL_GET_TIME")
	public Date getRealGetTime() {
		return realGetTime;
	}

	public void setRealGetTime(Date realGetTime) {
		this.realGetTime = realGetTime;
	}

	@Column(name = "REAL_RET_TIME")
	public Date getRealRetTime() {
		return realRetTime;
	}

	public void setRealRetTime(Date realRetTime) {
		this.realRetTime = realRetTime;
	}

	@Column(name = "GET_KM")
	public Double getGetKm() {
		return getKm;
	}

	public void setGetKm(Double getKm) {
		this.getKm = getKm;
	}

	@Column(name = "RET_KM")
	public Double getRetKm() {
		return retKm;
	}

	public void setRetKm(Double retKm) {
		this.retKm = retKm;
	}

	@Column(name = "RUN_MILES")
	public Double getRunMiles() {
		return runMiles;
	}

	public void setRunMiles(Double runMiles) {
		this.runMiles = runMiles;
	}

	@Column(name = "GET_ELEC")
	public Double getGetElec() {
		return getElec;
	}

	public void setGetElec(Double getElec) {
		this.getElec = getElec;
	}

	@Column(name = "RET_ELEC")
	public Double getRetElec() {
		return retElec;
	}

	public void setRetElec(Double retElec) {
		this.retElec = retElec;
	}

	@Column(name = "GET_CHECKER")
	public String getGetChecker() {
		return getChecker;
	}

	public void setGetChecker(String getChecker) {
		this.getChecker = getChecker;
	}

	@Column(name = "RET_CHECKER")
	public String getRetChecker() {
		return retChecker;
	}

	public void setRetChecker(String retChecker) {
		this.retChecker = retChecker;
	}

	@Column(name = "GET_REMARK")
	public String getGetRemark() {
		return getRemark;
	}

	public void setGetRemark(String getRemark) {
		this.getRemark = getRemark;
	}

	@Column(name = "RET_REMARK")
	public String getRetRemark() {
		return retRemark;
	}

	public void setRetRemark(String retRemark) {
		this.retRemark = retRemark;
	}

	@Column(name = "GET_STATION_ID")
	public Long getGetStationId() {
		return getStationId;
	}

	public void setGetStationId(Long getStationId) {
		this.getStationId = getStationId;
		// ServiceStation
		// station=ServiceStationCache.getInstance().getServiceStation(getStationId);
		// if (station!=null){
		// this.getStationName=station.getStationName();
		// ServiceArea
		// area=ServiceAreaCache.getInstance().getAreaService(station.getAreaId());
		// this.getAreaName=area.getAreaName();
		// }
	}

	@Column(name = "RET_STATION_ID")
	public Long getRetStationId() {
		return retStationId;
	}

	public void setRetStationId(Long retStationId) {
		this.retStationId = retStationId;
		// ServiceStation
		// station=ServiceStationCache.getInstance().getServiceStation(retStationId);
		// if (station!=null){
		// this.retStationName=station.getStationName();
		// ServiceArea
		// area=ServiceAreaCache.getInstance().getAreaService(station.getAreaId());
		// this.retAreaName=area.getAreaName();
		// }
	}

	@Column(name = "REAL_RET_STATION_ID")
	public Long getRealRetStationId() {
		return realRetStationId;
	}

	public void setRealRetStationId(Long realRetStationId) {
		this.realRetStationId = realRetStationId;
		// if(realRetStationId!=null){
		// ServiceStation
		// station=ServiceStationCache.getInstance().getServiceStation(realRetStationId);
		// if (station!=null){
		// this.realRetStationName=station.getStationName();
		// ServiceArea
		// area=ServiceAreaCache.getInstance().getAreaService(station.getAreaId());
		// this.realRetAreaName=area.getAreaName();
		// }
		// }

	}

	@Column(name = "GET_OPERATOR_ID")
	public Long getGetOperatorId() {
		return getOperatorId;
	}

	public void setGetOperatorId(Long getOperatorId) {
		this.getOperatorId = getOperatorId;
	}

	@Column(name = "RET_OPERATOR_ID")
	public Long getRetOperatorId() {
		return retOperatorId;
	}

	public void setRetOperatorId(Long retOperatorId) {
		this.retOperatorId = retOperatorId;
	}

	@Column(name = "CREATE_TIME")
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "MOD_TIME")
	public Date getModTime() {
		return modTime;
	}

	public void setModTime(Date modTime) {
		this.modTime = modTime;
	}

	@Column(name = "VEHICLE_TYPE_NAME")
	public String getVehicleTypeName() {
		return vehicleTypeName;
	}

	public void setVehicleTypeName(String vehicleTypeName) {
		this.vehicleTypeName = vehicleTypeName;
	}

	@Column(name = "VEHICLE_TYPE_ID")
	public Long getVehicleTypeId() {
		return vehicleTypeId;
	}

	public void setVehicleTypeId(Long vehicleTypeId) {
		this.vehicleTypeId = vehicleTypeId;
	}

	@Column(name = "RENTAL_TYPE")
	public String getRentalType() {
		return rentalType;
	}

	public void setRentalType(String rentalType) {
		this.rentalType = rentalType;
	}

	@Column(name = "RENTAL_FEE")
	public Double getRentalFee() {
		return rentalFee;
	}

	public void setRentalFee(Double rentalFee) {
		this.rentalFee = rentalFee;
	}

	@Column(name = "TOTAL_AMOUNT")
	public Double getTotalAmount() {
		return totalAmount;
	}

	public void setTotalAmount(Double totalAmount) {
		this.totalAmount = totalAmount;
	}

	@Column(name = "CHARGE_AMOUNT")
	public Integer getChargeAmount() {
		return chargeAmount;
	}

	public void setChargeAmount(Integer chargeAmount) {
		this.chargeAmount = chargeAmount;
	}

	@Column(name = "ATTATCH_SERVICE_FEE")
	public Double getAttatchServiceFee() {
		return attatchServiceFee;
	}

	public void setAttatchServiceFee(Double attatchServiceFee) {
		this.attatchServiceFee = attatchServiceFee;
	}

	@Transient
	public String getDisplayGetTime() {
		return displayGetTime;
	}

	@Transient
	public String getDisplayRetTime() {
		return displayRetTime;
	}

	@Column(name = "DEPOSIT")
	public Double getDeposit() {
		return deposit == null ? 0 : deposit;
	}

	public void setDeposit(Double deposit) {
		this.deposit = deposit;
	}

	@Column(name = "ret_longtitude")
	public Double getRetLongtitude() {
		return retLongtitude;
	}

	public void setRetLongtitude(Double retLongtitude) {
		this.retLongtitude = retLongtitude;
	}

	@Column(name = "ret_latitude")
	public Double getRetLatitude() {
		return retLatitude;
	}

	public void setRetLatitude(Double retLatitude) {
		this.retLatitude = retLatitude;
	}

	@Column(name = "rentalprice")
	public Double getRentalPrice() {
		return rentalPrice;
	}

	public void setRentalPrice(Double rentalPrice) {
		this.rentalPrice = rentalPrice;
	}

	@Column(name = "RENTAL_TIME")
	public Long getRentalTime() {
		return rentalTime;
	}

	public void setRentalTime(Long rentalTime) {
		this.rentalTime = rentalTime;
	}

	@Column(name = "ALLOTTIME")
	public Date getAllotTime() {
		return allotTime;
	}

	public void setAllotTime(Date allotTime) {
		this.allotTime = allotTime;
	}

	@Column(name = "PRICE_ID")
	public Long getPriceId() {
		return priceId;
	}

	public void setPriceId(Long priceId) {
		this.priceId = priceId;
	}

	@Column(name = "CPRICE_ID")
	public Long getCpriceId() {
		return cpriceId;
	}

	public void setCpriceId(Long cpriceId) {
		this.cpriceId = cpriceId;
	}

}
